package database.viewer;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;

public class ImagePanel extends JPanel {
	private BufferedImage	image;
	
	public ImagePanel() {
		this.image = null;
		setBackground(Color.gray);
		setBorder( new LineBorder(Color.black) );
	}

	public void setImage( BufferedImage image ) {
		this.image = image;
	}
	
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		
		if (image != null)
			g.drawImage(image, (getWidth() - image.getWidth())/2, (getHeight() - image.getHeight())/2, null);
	}

}
